<?php
namespace app\admin\model;
use think\Model as UserModel;
use traits\model\SoftDelete;

class Lden extends UserModel
{
	
	
	public function logings($id)//查询管理员身份
	{
		
		//获取权限信息
		return  $this->table('mall_mall_adm_lden admlden, mall_lden lden')->where("admlden.lid = lden.lid = $id")->select();

	}
	public function userinfo($id)//获取管理员信息
	{
		
		return $this->get($id);
	}
	public function userpower($id)//权限
	{

		  $this->table('mall_mall_lden_power admpower, mall_power lden')->where("admpower.pid = lden.pid = $id")->select();
		  return $this->getLastSql();
	}
	public function lden()
	{
		return   $this->belongsToMany('lden');
	}
	

}


// $data=$user->alias('u')
//             // ->join('consumption con','con.uid=u.id')
//             ->join('(select a.*,sum(money) summoney from (select * from client_consumption ORDER BY jz_time desc) a group by a.uid ) con','con.uid=u.id')
//             ->join('province p','p.province_id=u.province_id','LEFT')
//             ->join('city c','c.city_id=u.city_id','LEFT')
//             ->join('county co','co.county_id=u.county_id','LEFT')
//             ->join('dev_from d','d.id=u.dev_id','LEFT')
//             ->join('source s','s.id=u.from_id','LEFT')
//             ->join('zx_tools z','z.id=u.tool_id','LEFT')
//             ->join('wangdian_zixun w','w.id=wdzx_id','LEFT')
//             ->join('qiantai_zixun q','q.id=qtzx_id','LEFT')
//             ->join('doctors doc','doc.id=doctor_id','LEFT')
//             ->join('disease dis','dis.id=disease_id','LEFT')
//             ->field('u.id,u.name,u.sex,u.birthday,u.age,u.telephone,p.province_name,c.city_name,co.county_name,d.dev,source_name,z.tool,wd_name wdname,qt_name qtname,doc.doctor,disease_name,jz_time,summoney,addtime')
//             // ->group('u.id')
//             ->where('name|telephone','like',"%$name%")
//             ->where('summoney',['>',$startmoney],['<',$endmoney],'and')
//             ->order([$sort=>$order])
//             ->limit($offset,$rows)
//             ->select(false);
//             dump($data);
//             exit;
